﻿//
//  Copyright (c) 2011 Extreme: Paweł Huryn (lead), Jakub Domański
//

using System;
using System.Collections.Generic;

namespace Extreme.SPFramework.Configuration
{
    /// <summary>
    /// Entity mapping (property name -> sp column name)
    /// </summary>
    public class EntityMapping
    {
        /// <summary>
        /// Creates new instance od entity mapping
        /// </summary>
        /// <param name="entityType">Type of entity</param>
        /// <param name="sharepointListName"></param>
        /// <param name="mappings"></param>
        public EntityMapping(Type entityType, string sharepointListName, IDictionary<string, PropertyMapping> mappings)
        {
            SharepointListName = sharepointListName;
            PropertiesMapping = new Dictionary<string, PropertyMapping>(mappings);
        }

        /// <summary>
        /// Creates new instance od entity mapping
        /// </summary>
        /// <param name="entityType">Type of entity</param>
        /// <param name="sharepointListName"></param>
        /// <param name="mappings"></param>
        /// <param name="siteUrl">Site url</param>
        /// <param name="webName">Web name</param>
        public EntityMapping(Type entityType, string sharepointListName, IDictionary<string, PropertyMapping> mappings, string siteUrl, string webName)
        {
            SharepointListName = sharepointListName;
            SiteUrl = siteUrl;
            WebName = webName;
            PropertiesMapping = new Dictionary<string, PropertyMapping>(mappings);
        }

        /// <summary>
        /// Type of entity
        /// </summary>
        public Type EntityType { get; private set; }

        /// <summary>
        /// SP list name
        /// </summary>
        public string SharepointListName { get; private set; }

        /// <summary>
        /// Site url
        /// </summary>
        public string SiteUrl { get; set; }

        /// <summary>
        /// Web name
        /// </summary>
        public string WebName { get; set; }

        /// <summary>
        /// Properties mapping
        /// </summary>
        public Dictionary<string, PropertyMapping> PropertiesMapping { get; private set; }
    }


}
